import request from '@/utils/request'

// 查询企业部门列表
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

// 获取部门领导列表
export function getLeaderList() {
  return request({
    url: '/sys/user/simple',
    method: 'get'

  })
}

// 新增部门
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data: data
  })
}

// 根据id查询部门 数据回显
export function getDepartmentById(id) {
  return request({
    url: '/company/department/' + id,
    method: 'get'
  })
}

// 实现编辑功能
export function editDepartment(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data: data
  })
}

// 实现删除部门的功能
export function deleteDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
